// SampleScripts.js
//


Type.createNamespace('SampleScripts.core');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.core.TemplateScript

SampleScripts.core.TemplateScript = function SampleScripts_core_TemplateScript() {
}
SampleScripts.core.TemplateScript.main = function SampleScripts_core_TemplateScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.core.TemplateScript().init();
    }));
}
SampleScripts.core.TemplateScript.prototype = {
    _p1: null,
    _p2: null,
    
    init: function SampleScripts_core_TemplateScript$init() {
        var data = { name: 'Jack Slocum', company: 'Ext JS, LLC', address: '4 Red Bulls Drive', city: 'Cleveland', state: 'Ohio', zip: '44102', kids: [ { name: 'Sara Grace', age: 3 }, { name: 'Zachary', age: 2 }, { name: 'John James', age: 0 } ] };
        this._p1 = new Ext.Panel(new Ext.PanelConfig().title('Basic Template').width(300).html('<p><i>Apply the template to see results here</i></p>').tbar([ new Ext.Toolbar.ButtonConfig().text('Apply Template').handler(Delegate.create(this, function() {
            var tpl = new Ext.Template('<p>Name: {name}</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Company: {company}</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Location: {city}, {state}</p>');
            var body = this._p1.body;
            tpl.overwrite(body, data);
            body.highlight('#c3daf9', { block: true });
        })).toDictionary() ]).renderTo(document.body).toDictionary());
        this._p2 = new Ext.Panel(new Ext.PanelConfig().title('XTemplate').width(300).html('<p><i>Apply the template to see results here</i></p>').tbar([ new Ext.Toolbar.ButtonConfig().text('Apply Template').handler(Delegate.create(this, function() {
            var tpl = new Ext.XTemplate('<p>Name: {name}</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Company: {company}</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Location: {city}, {state}</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Kids: \r\n\t\t\t\t\t\t\t\t\t\t\t<tpl for=\"kids\" if=\"name==\'Jack Slocum\'\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<tpl if=\"age &gt; 1\"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>\r\n\t\t\t\t\t\t\t\t\t\t\t</tpl></p>');
            var body = this._p2.body;
            tpl.overwrite(body, data);
            body.highlight('#c3daf9', { block: true });
        })).toDictionary() ]).renderTo(document.body).toDictionary());
    }
}


Type.createNamespace('SampleScripts.grid');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.ArrayGridScript

SampleScripts.grid.ArrayGridScript = function SampleScripts_grid_ArrayGridScript() {
}
SampleScripts.grid.ArrayGridScript.main = function SampleScripts_grid_ArrayGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.ArrayGridScript().init();
    }));
}
SampleScripts.grid.ArrayGridScript.prototype = {
    
    init: function SampleScripts_grid_ArrayGridScript$init() {
        var myData = this._getMyData();
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().reader(new Ext.data.ArrayReader({}, [ { name: 'company' }, { name: 'price', type: 'float' }, { name: 'change', type: 'float' }, { name: 'pctChange', type: 'float' }, { name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia' } ])).toDictionary());
        ds.loadData(myData);
        var colModel = new Ext.grid.ColumnModel([ { id: 'company', header: 'Company', width: 160, sortable: true, locked: false, dataIndex: 'company' }, { header: 'Price', width: 75, sortable: true, renderer: Delegate.create(null, Ext.util.Format.usMoney), dataIndex: 'price' }, { header: 'Change', width: 75, sortable: true, renderer: Delegate.create(this, this._change), dataIndex: 'change' }, { header: '% Change', width: 75, sortable: true, renderer: Delegate.create(this, this._pctChange), dataIndex: 'pctChange' }, { header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange' } ]);
        var grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().el('grid-example').ds(ds).cm(colModel).autoExpandColumn('company').height(350).width(600).title('Array Grid').toDictionary());
        grid.render();
        (grid.getSelectionModel()).selectFirstRow();
    },
    
    _italic: function SampleScripts_grid_ArrayGridScript$_italic(val) {
        return '<i>' + val + '</i>';
    },
    
    _change: function SampleScripts_grid_ArrayGridScript$_change(val) {
        if (val > 0) {
            return '<span style=\"color:green;\">' + val + '</span>';
        }
        else if (val < 0) {
            return '<span style=\"color:red;\">' + val + '</span>';
        }
        return val;
    },
    
    _pctChange: function SampleScripts_grid_ArrayGridScript$_pctChange(val) {
        if (val > 0) {
            return '<span style=\"color:green;\">' + val + '%</span>';
        }
        else if (val < 0) {
            return '<span style=\"color:red;\">' + val + '%</span>';
        }
        return val;
    },
    
    _getMyData: function SampleScripts_grid_ArrayGridScript$_getMyData() {
        return [ [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am' ], [ '3m Co', 71.72, 0.02, 0.03, '9/1 12:00am' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am' ], [ 'American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '9/1 12:00am' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '9/1 12:00am' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '9/1 12:00am' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am' ] ];
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.EditGridScript

SampleScripts.grid.EditGridScript = function SampleScripts_grid_EditGridScript() {
}
SampleScripts.grid.EditGridScript.main = function SampleScripts_grid_EditGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.EditGridScript().init();
    }));
}
SampleScripts.grid.EditGridScript.prototype = {
    
    init: function SampleScripts_grid_EditGridScript$init() {
        var checkCol = new SampleScripts.grid.CheckColumn(new Ext.grid.ColumnModelConfig().header('Indoor?').dataIndex('indoor').width(55).toDictionary());
        var cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().id('common').header('Common Name').dataIndex('common').width(220).editor(new Ext.form.TextField(new Ext.form.TextFieldConfig().allowBlank(false).toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Light').dataIndex('light').width(130).editor(new Ext.form.ComboBox(new Ext.form.ComboBoxConfig().typeAhead(true).triggerAction('all').transform('light').lazyRender(true).listClass('x-combo-list-small').toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Price').dataIndex('price').width(70).align('right').renderer(Delegate.create(null, Ext.util.Format.usMoney)).editor(new Ext.form.NumberField(new Ext.form.NumberFieldConfig().allowBlank(false).allowNegative(false).maxValue(100000).toDictionary())).toDictionary(), new Ext.grid.ColumnModelConfig().header('Available').dataIndex('availDate').width(95).renderer(Delegate.create(this, this.formatDate)).editor(new Ext.form.DateField(new Ext.form.DateFieldConfig().format('m/d/y').minValue('01/01/06').disabledDays([ 0, 6 ]).disabledDaysText('Plants are not available on the weekends').toDictionary())).toDictionary(), checkCol ]);
        cm.defaultSortable = true;
        var plantDef = [ { name: 'common', type: 'string' }, { name: 'botanical', type: 'string' }, { name: 'light' }, { name: 'price', type: 'float' }, { name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y' }, { name: 'indoor', type: 'bool' } ];
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().url('plants.xml').reader(new Ext.data.XmlReader(new Ext.data.XmlReaderConfig().record('plant').toDictionary(), plantDef)).sortInfo({ field: 'common', direction: 'ASC' }).toDictionary());
        var grid = null;
        grid = new Ext.grid.EditorGridPanel(new Ext.grid.EditorGridPanelConfig().ds(ds).cm(cm).renderTo('editor-grid').width(600).height(300).autoExpandColumn('common').title('Edit Plants?').frame(true).plugins(checkCol).clicksToEdit(1).tbar([ { text: 'Add Plant', handler: Delegate.create(this, function() {
            var p = new Ext.data.Record(plantDef);
            grid.stopEditing();
            ds.insert(0, [ p ]);
            p.set('common', 'New Plant 1');
            p.set('light', 'Mostly Shade');
            p.set('price', 0);
            p.set('availDate', new Date());
            p.set('indoor', false);
            grid.startEditing(0, 0);
        }) } ]).toDictionary());
        ds.load();
    },
    
    formatBoolean: function SampleScripts_grid_EditGridScript$formatBoolean(value) {
        return (value) ? 'Yes' : 'No';
    },
    
    formatDate: function SampleScripts_grid_EditGridScript$formatDate(value) {
        return (isNullOrUndefined(value)) ? '' : value.dateFormat('M d, Y');
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.CheckColumn

SampleScripts.grid.CheckColumn = function SampleScripts_grid_CheckColumn(config) {
    ExtClass.apply(this, config, null);
    if (isNullOrUndefined(this.id)) {
        this.id = ExtClass.id();
    }
}
SampleScripts.grid.CheckColumn.prototype = {
    id: null,
    dataIndex: null,
    grid: null,
    
    init: function SampleScripts_grid_CheckColumn$init(g) {
        this.grid = g;
        this.grid.on('render', Delegate.create(this, function() {
            var view = this.grid.getView();
            var el = view.mainBody;
            el.on('mousedown', Delegate.create(this, this.onMouseDown), this);
        }), this);
    },
    
    onMouseDown: function SampleScripts_grid_CheckColumn$onMouseDown(e, t) {
        if (!isNullOrUndefined(t.className) && t.className.indexOf('x-grid3-cc-' + this.id) !== -1) {
            e.stopEvent();
            var index = this.grid.getView().findRowIndex(t);
            var record = this.grid.store.getAt(index);
            var val = record.get(this.dataIndex);
            record.set(this.dataIndex, !val);
        }
    },
    
    renderer: function SampleScripts_grid_CheckColumn$renderer(value, p, record) {
        p['css'] += ' x-grid3-check-col-td';
        return '<div class=\"x-grid3-check-col' + ((value) ? '-on' : '') + ' x-grid3-cc-' + this.id + '\">&#160;</div>';
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.GroupingGridScript

SampleScripts.grid.GroupingGridScript = function SampleScripts_grid_GroupingGridScript() {
}
SampleScripts.grid.GroupingGridScript.main = function SampleScripts_grid_GroupingGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.GroupingGridScript().init();
    }));
}
SampleScripts.grid.GroupingGridScript.prototype = {
    
    init: function SampleScripts_grid_GroupingGridScript$init() {
        var reader = new Ext.data.ArrayReader(new Ext.data.ArrayReaderConfig().toDictionary(), [ { name: 'company' }, { name: 'price', type: 'float' }, { name: 'change', type: 'float' }, { name: 'pctChange', type: 'float' }, { name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia' }, { name: 'industry' }, { name: 'desc' } ]);
        var gds = new Ext.data.GroupingStore(new Ext.data.GroupingStoreConfig().reader(reader).data(this._getData()).sortInfo({ field: 'company', direction: 'ASC' }).groupField('industry').toDictionary());
        var columns = [ { id: 'company', header: 'Company', width: 60, sortable: true, dataIndex: 'company' }, { header: 'Price', width: 20, sortable: true, renderer: Delegate.create(null, Ext.util.Format.usMoney), dataIndex: 'price' }, { header: 'Change', width: 20, sortable: true, dataIndex: 'change', renderer: Delegate.create(null, Ext.util.Format.usMoney) }, { header: 'Industry', width: 20, sortable: true, dataIndex: 'industry' }, { header: 'Last Updated', width: 20, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange' } ];
        var view = new Ext.grid.GroupingView(new Ext.grid.GroupingViewConfig().forceFit(true).groupTextTpl('{text} ({[values.rs.length]} {[values.rs.length > 1 ? \"Items\" : \"Item\"]})').toDictionary());
        var grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().ds(gds).columns(columns).view(view).frame(true).width(700).height(400).collapsible(true).animCollapse(false).title('Grouping Example').iconCls('icon-grid').renderTo(document.body).toDictionary());
    },
    
    _getData: function SampleScripts_grid_GroupingGridScript$_getData() {
        return [ [ '3m Co', 71.72, 0.02, 0.03, '4/2 12:00am', 'Manufacturing' ], [ 'Alcoa Inc', 29.01, 0.42, 1.47, '4/1 12:00am', 'Manufacturing' ], [ 'Altria Group Inc', 83.81, 0.28, 0.34, '4/3 12:00am', 'Manufacturing' ], [ 'American Express Company', 52.55, 0.01, 0.02, '4/8 12:00am', 'Finance' ], [ 'American International Group, Inc.', 64.13, 0.31, 0.49, '4/1 12:00am', 'Services' ], [ 'AT&T Inc.', 31.61, -0.48, -1.54, '4/8 12:00am', 'Services' ], [ 'Boeing Co.', 75.43, 0.53, 0.71, '4/8 12:00am', 'Manufacturing' ], [ 'Caterpillar Inc.', 67.27, 0.92, 1.39, '4/1 12:00am', 'Services' ], [ 'Citigroup, Inc.', 49.37, 0.02, 0.04, '4/4 12:00am', 'Finance' ], [ 'E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '4/1 12:00am', 'Manufacturing' ], [ 'Exxon Mobil Corp', 68.1, -0.43, -0.64, '4/3 12:00am', 'Manufacturing' ], [ 'General Electric Company', 34.14, -0.08, -0.23, '4/3 12:00am', 'Manufacturing' ], [ 'General Motors Corporation', 30.27, 1.09, 3.74, '4/3 12:00am', 'Automotive' ], [ 'Hewlett-Packard Co.', 36.53, -0.03, -0.08, '4/3 12:00am', 'Computer' ], [ 'Honeywell Intl Inc', 38.77, 0.05, 0.13, '4/3 12:00am', 'Manufacturing' ], [ 'Intel Corporation', 19.88, 0.31, 1.58, '4/2 12:00am', 'Computer' ], [ 'International Business Machines', 81.41, 0.44, 0.54, '4/1 12:00am', 'Computer' ], [ 'Johnson & Johnson', 64.72, 0.06, 0.09, '4/2 12:00am', 'Medical' ], [ 'JP Morgan & Chase & Co', 45.73, 0.07, 0.15, '4/2 12:00am', 'Finance' ], [ 'McDonald\"s Corporation', 36.76, 0.86, 2.4, '4/2 12:00am', 'Food' ], [ 'Merck & Co., Inc.', 40.96, 0.41, 1.01, '4/2 12:00am', 'Medical' ], [ 'Microsoft Corporation', 25.84, 0.14, 0.54, '4/2 12:00am', 'Computer' ], [ 'Pfizer Inc', 27.96, 0.4, 1.45, '4/8 12:00am', 'Services', 'Medical' ], [ 'The Coca-Cola Company', 45.07, 0.26, 0.58, '4/1 12:00am', 'Food' ], [ 'The Home Depot, Inc.', 34.64, 0.35, 1.02, '4/8 12:00am', 'Retail' ], [ 'The Procter & Gamble Company', 61.91, 0.01, 0.02, '4/1 12:00am', 'Manufacturing' ], [ 'United Technologies Corporation', 63.26, 0.55, 0.88, '4/1 12:00am', 'Computer' ], [ 'Verizon Communications', 35.57, 0.39, 1.11, '4/3 12:00am', 'Services' ], [ 'Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '4/3 12:00am', 'Retail' ], [ 'Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.81, '4/1 12:00am', 'Services' ] ];
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.PagingGridScript

SampleScripts.grid.PagingGridScript = function SampleScripts_grid_PagingGridScript() {
}
SampleScripts.grid.PagingGridScript.main = function SampleScripts_grid_PagingGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.PagingGridScript().init();
    }));
}
SampleScripts.grid.PagingGridScript.prototype = {
    _grid: null,
    _cm: null,
    
    init: function SampleScripts_grid_PagingGridScript$init() {
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().custom('proxy', new Ext.data.ScriptTagProxy(new Ext.data.ScriptTagProxyConfig().url('http://extjs.com/forum/topics-browse-remote.php').toDictionary())).reader(new Ext.data.JsonReader(new Ext.data.JsonReaderConfig().root('topics').totalProperty('totalCount').id('threadid').toDictionary(), [ 'title', 'forumtitle', 'forumid', 'author', { name: 'replycount', type: 'int' }, { name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp' }, 'lastposter', 'excerpt' ])).remoteSort(true).toDictionary());
        ds.setDefaultSort('lastpost', 'desc');
        this._cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().id('topic').header('Topic').dataIndex('title').width(420).renderer(Delegate.create(this, this._renderTopic)).toDictionary(), new Ext.grid.ColumnModelConfig().header('Author').dataIndex('author').width(100).hidden(true).toDictionary(), new Ext.grid.ColumnModelConfig().header('Replies').dataIndex('replycount').width(70).align('right').toDictionary(), new Ext.grid.ColumnModelConfig().id('last').header('Last Post').dataIndex('lastpost').width(150).renderer(Delegate.create(this, this._renderLast)).toDictionary() ]);
        this._cm.defaultSortable = true;
        var tb = new Ext.PagingToolbar(new Ext.PagingToolbarConfig().pageSize(25).store(ds).displayInfo(true).displayMsg('Displaying topics {0} - {1} of {2}').emptyMsg('No topics to display').items([ '-', new Ext.ButtonConfig().pressed(true).enableToggle(true).text('Show Preview').cls('x-btn-text-icon details').toggleHandler(Delegate.create(this, this._toggleDetails)).toDictionary() ]).toDictionary());
        var viewConfig = new Ext.grid.GridViewConfig().forceFit(true).enableRowBody(true).custom('showPreview', true).getRowClass(Delegate.create(this, this._getRowClass));
        this._grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().el('topic-grid').width(700).height(500).title('ExtJS.com - Browse Forums').store(ds).cm(this._cm).trackMouseOver(false).sm(new Ext.grid.RowSelectionModel({ selectRow: Delegate.create(null, ExtClass.emptyFn) })).loadMask(true).viewConfig(viewConfig.toDictionary()).bbar(tb).toDictionary());
        this._grid.render();
        ds.load({ params: { start: 0, limit: 25, forumId: 4 } });
    },
    
    _toggleDetails: function SampleScripts_grid_PagingGridScript$_toggleDetails(btn, pressed) {
        var view = this._grid.getView();
        view.showPreview = pressed;
        view.refresh();
    },
    
    _getRowClass: function SampleScripts_grid_PagingGridScript$_getRowClass(record, index, rowParams, ds) {
        if (this._grid.getView().showPreview) {
            rowParams['body'] = '<p>' + record.get('excerpt') + '</p>';
            return 'x-grid3-row-expanded';
        }
        return 'x-grid3-row-collapsed';
    },
    
    _renderTopic: function SampleScripts_grid_PagingGridScript$_renderTopic(value, meta, rec) {
        return ExtString.format('<b><a href=\"http://extjs.com/forum/showthread.php?t={2}\" target=\"_blank\">{0}</a></b>' + '<a href=\"http://extjs.com/forum/forumdisplay.php?f={3}\" target=\"_blank\">{1} Forum</a>', value, rec.get('forumtitle'), rec.get('id'), rec.get('forumid'));
    },
    
    _renderLast: function SampleScripts_grid_PagingGridScript$_renderLast(value, meta, rec) {
        return ExtString.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), rec.get('author'));
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.TotalsGridScript

SampleScripts.grid.TotalsGridScript = function SampleScripts_grid_TotalsGridScript() {
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.grid.XmlGridScript

SampleScripts.grid.XmlGridScript = function SampleScripts_grid_XmlGridScript() {
}
SampleScripts.grid.XmlGridScript.main = function SampleScripts_grid_XmlGridScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.grid.XmlGridScript().init();
    }));
}
SampleScripts.grid.XmlGridScript.prototype = {
    
    init: function SampleScripts_grid_XmlGridScript$init() {
        var ds = new Ext.data.Store(new Ext.data.StoreConfig().url('sheldon.xml').reader(new Ext.data.XmlReader(new Ext.data.XmlReaderConfig().record('Item').id('ASIN').totalRecords('@total').toDictionary(), [ { name: 'Author', mapping: 'ItemAttributes > Author' }, 'Title', 'Manufacturer', 'ProductGroup' ])).toDictionary());
        var cm = new Ext.grid.ColumnModel([ new Ext.grid.ColumnModelConfig().header('Author').width(120).dataIndex('Author').toDictionary(), new Ext.grid.ColumnModelConfig().header('Title').width(180).dataIndex('Title').toDictionary(), new Ext.grid.ColumnModelConfig().header('Manufacturer').width(115).dataIndex('Manufacturer').toDictionary(), new Ext.grid.ColumnModelConfig().header('Product Group').width(100).dataIndex('ProductGroup').toDictionary() ]);
        cm.defaultSortable = true;
        var grid = new Ext.grid.GridPanel(new Ext.grid.GridPanelConfig().ds(ds).cm(cm).renderTo('example-grid').width(540).height(200).toDictionary());
        ds.load();
    }
}


Type.createNamespace('SampleScripts');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.IFrameComponent

SampleScripts.IFrameComponent = function SampleScripts_IFrameComponent(config) {
    SampleScripts.IFrameComponent.constructBase(this, [ config ]);
}
SampleScripts.IFrameComponent.prototype = {
    el: null,
    url: '#',
    
    onRender: function SampleScripts_IFrameComponent$onRender(ct, position) {
        this.el = ct.createChild({ tag: 'iframe', id: 'framepanel' + this.id, frameBorder: 0, src: this.url });
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.SamplePanel

SampleScripts.SamplePanel = function SampleScripts_SamplePanel(config) {
    SampleScripts.SamplePanel.constructBase(this, [ config ]);
}
SampleScripts.SamplePanel.prototype = {
    autoHeight: true,
    frame: true,
    collapsible: true,
    cls: 'demos',
    
    afterRender: function SampleScripts_SamplePanel$afterRender() {
        eval('SampleScripts.SamplePanel.superclass.afterRender.call(this);');
        SampleScripts.SamplePanel.tpl.overwrite(this.body, this);
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.DefaultScript

SampleScripts.DefaultScript = function SampleScripts_DefaultScript() {
}
SampleScripts.DefaultScript.main = function SampleScripts_DefaultScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.DefaultScript().init();
    }));
}
SampleScripts.DefaultScript.prototype = {
    
    init: function SampleScripts_DefaultScript$init() {
        var catalog = [ { title: 'Grids', samples: [ { text: 'Basic Array Grid', url: 'grid/array-grid.aspx', icon: 'grid-array.gif' }, { text: 'Editable Grid', url: 'grid/edit-grid.aspx', icon: 'grid-edit.gif' }, { text: 'XML Grid', url: 'grid/xml-grid.aspx', icon: 'grid-xml.gif' }, { text: 'Paging', url: 'grid/paging.aspx', icon: 'grid-paging.gif' }, { text: 'Grouping', url: 'grid/grouping.aspx', icon: 'grid-grouping.gif' }, { text: 'Live Group Summary', url: 'grid/totals.aspx', icon: 'grid-summary.gif' }, { text: 'Customizing: Grid Plugins', url: 'grid/grid3.aspx', icon: 'grid-plugins.gif' } ] }, { title: 'Tabs', samples: [ { text: 'Basic Tabs', url: 'tabs/tabs.aspx', icon: 'tabs.gif' }, { text: 'Advanced Tabs', url: 'tabs/tabs-adv.aspx', icon: 'tabs-adv.gif' } ] }, { title: 'Windows', samples: [ { text: 'Hello World', url: 'window/hello.aspx', icon: 'window.gif' }, { text: 'MessageBox', url: 'message-box/msg-box.aspx', icon: 'msg-box.gif' } ] }, { title: 'Trees', samples: [ { text: 'Drag and Drop Reordering', url: 'tree/reorder.aspx', icon: 'tree-reorder.gif' }, { text: 'Multiple trees', url: 'tree/two-trees.aspx', icon: 'tree-two.gif' }, { text: 'Customizing: Column Tree', url: 'tree/column-tree.aspx', icon: 'tree-columns.gif' } ] }, { title: 'Layout Managers', samples: [ { text: 'Border Layout', url: 'layout/complex.aspx', icon: 'border-layout.gif' }, { text: 'Anchor Layout', url: 'form/anchoring.aspx', icon: 'anchor.gif' }, { text: 'Customizing: Portals', url: 'layout/portal.aspx', icon: 'portal.gif' } ] }, { title: 'ComboBox', samples: [ { text: 'Basic ComboBox', url: 'form/combos.aspx', icon: 'combo.gif' }, { text: 'Customizing: ComboBox Templates', url: 'form/forum-search.aspx', icon: 'combo-custom.gif' } ] }, { title: 'Forms', samples: [ { text: 'Dynamic Forms', url: 'form/dynamic.aspx', icon: 'form-dynamic.gif' }, { text: 'Ajax with XML Forms', url: 'form/xml-form.aspx', icon: 'form-xml.gif' }, { text: 'Customizing: Search Field', url: 'form/custom.aspx', icon: 'form-custom.gif' } ] }, { title: 'Toolbars and Menus', samples: [ { text: 'Basic Toolbar', url: 'menu/menus.aspx', icon: 'toolbar.gif' }, { text: 'Ext Actions', url: 'menu/actions.aspx', icon: 'toolbar-actions.gif' } ] }, { title: 'Miscellaneous', samples: [ { text: 'DataView', url: 'view/data-view.aspx', icon: 'data-view.gif' }, { text: 'Progress Bar', url: 'simple-widgets/progress-bar.aspx', icon: 'progress.gif' }, { text: 'Templates', url: 'core/templates.aspx', icon: 'templates.gif' }, { text: 'Panels', url: 'panel/panels.aspx', icon: 'panel.gif' }, { text: 'Resizable', url: 'resizable/basic.aspx', icon: 'resizable.gif' } ] } ];
        for (var i = 0; i < catalog.length; i++) {
            var c = catalog[i];
            c['id'] = 'sample-' + i;
            new SampleScripts.SamplePanel(c).render('all-demos');
        }
        var tpl = new Ext.XTemplate('<dl><tpl for=\".\"><dt><a href=\"#{id}\">{title:stripTags}</a></dt></tpl></dl>');
        tpl.overwrite('demo-menu', catalog);
        ExtClass.select('#sample-spacer').remove();
        ExtClass.get('loading').fadeOut({ remove: true });
    }
}


Type.createNamespace('SampleScripts.panel');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.panel.PanelScript

SampleScripts.panel.PanelScript = function SampleScripts_panel_PanelScript() {
}
SampleScripts.panel.PanelScript.main = function SampleScripts_panel_PanelScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.panel.PanelScript().init();
    }));
}
SampleScripts.panel.PanelScript.prototype = {
    
    init: function SampleScripts_panel_PanelScript$init() {
        new Ext.Panel(new Ext.PanelConfig().title('My Panel').collapsible(true).renderTo(document.body).width(400).html(SampleScripts.panel.PanelScript._html).toDictionary());
    }
}


Type.createNamespace('SampleScripts.resizable');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.resizable.BasicScript

SampleScripts.resizable.BasicScript = function SampleScripts_resizable_BasicScript() {
}
SampleScripts.resizable.BasicScript.main = function SampleScripts_resizable_BasicScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.resizable.BasicScript().init();
    }));
}
SampleScripts.resizable.BasicScript.prototype = {
    
    init: function SampleScripts_resizable_BasicScript$init() {
        new Ext.Resizable('basic', new Ext.ResizableConfig().width(200).height(100).minWidth(100).minHeight(50).toDictionary());
        new Ext.Resizable('animated', new Ext.ResizableConfig().width(200).pinned(true).height(100).minWidth(100).minHeight(50).animate(true).easing('backIn').custom('duration', 0.6).toDictionary());
        new Ext.Resizable('wrapped', new Ext.ResizableConfig().wrap(true).pinned(true).minWidth(50).minHeight(50).preserveRatio(true).toDictionary());
        new Ext.Resizable('transparent', new Ext.ResizableConfig().wrap(true).minWidth(50).minHeight(50).preserveRatio(true).transparent(true).toDictionary());
        var custom = new Ext.Resizable('custom', new Ext.ResizableConfig().wrap(true).pinned(true).minWidth(50).minHeight(50).preserveRatio(true).handles('all').draggable(true).dynamic(true).toDictionary());
        var customEl = custom.getEl();
        document.body.insertBefore(customEl.dom, document.body.firstChild);
        customEl.on('dblclick', Delegate.create(this, function() {
            customEl.hide(true);
        }));
        customEl.hide();
        ExtClass.get('showMe').on('click', Delegate.create(this, function() {
            customEl.center();
            customEl.show(true);
        }));
        new Ext.Resizable('dwrapped', new Ext.ResizableConfig().wrap(true).pinned(true).width(450).height(150).minWidth(200).minHeight(50).dynamic(true).toDictionary());
        new Ext.Resizable('snap', new Ext.ResizableConfig().wrap(true).width(250).height(100).handles('e').widthIncrement(50).minWidth(500).dynamic(true).toDictionary());
    }
}


Type.createNamespace('SampleScripts.simple_widgets');

////////////////////////////////////////////////////////////////////////////////
// SampleScripts.simple_widgets.ProgressBarScript

SampleScripts.simple_widgets.ProgressBarScript = function SampleScripts_simple_widgets_ProgressBarScript() {
}
SampleScripts.simple_widgets.ProgressBarScript.main = function SampleScripts_simple_widgets_ProgressBarScript$main(args) {
    ExtClass.onReady(Delegate.create(null, function() {
        new SampleScripts.simple_widgets.ProgressBarScript().init();
    }));
}
SampleScripts.simple_widgets.ProgressBarScript.prototype = {
    
    init: function SampleScripts_simple_widgets_ProgressBarScript$init() {
        var pbar1 = new Ext.ProgressBar(new Ext.ProgressBarConfig().custom('text', 'Initializing...').toDictionary());
        var btn1 = ExtClass.get('btn1');
        btn1.on('click', Delegate.create(this, function() {
            ExtClass.fly('p1text').update('Working');
            if (!pbar1.rendered) {
                pbar1.render('p1');
            }
            else {
                pbar1.text = 'Initializing...';
                pbar1.show();
            }
            SampleScripts.simple_widgets._runner.run(pbar1, ExtClass.get('btn1'), 10, Delegate.create(this, function() {
                pbar1.reset(true);
                ExtClass.fly('p1text').update('Done.').show();
            }));
        }));
        var pbar2 = new Ext.ProgressBar(new Ext.ProgressBarConfig().custom('text', 'Ready').id('pbar2').cls('left-align').renderTo('p2').toDictionary());
        var btn2 = ExtClass.get('btn2');
        btn2.on('click', Delegate.create(this, function() {
            SampleScripts.simple_widgets._runner.run(pbar2, btn2, 12, Delegate.create(this, function() {
                pbar2.reset();
                pbar2.updateText('Done.');
            }));
        }));
        var pbar3 = new Ext.ProgressBar(new Ext.ProgressBarConfig().id('pbar3').width(300).renderTo('p3').toDictionary());
        pbar3.on('update', Delegate.create(this, function() {
            ExtClass.fly('p3text').dom.innerHTML += '.';
        }));
        var btn3 = ExtClass.get('btn3');
        btn3.on('click', Delegate.create(this, function() {
            ExtClass.fly('p3text').update('Working');
            btn3.dom.disabled = true;
            pbar3.wait({ interval: 200, duration: 5000, increment: 15, fn: Delegate.create(this, function() {
                btn3.dom.disabled = false;
                ExtClass.fly('p3text').update('Done');
            }) });
        }));
        var pbar4 = new Ext.ProgressBar(new Ext.ProgressBarConfig().custom('text', 'Waiting on you...').id('pbar4').custom('textEl', 'p4text').cls('custom').renderTo('p4').toDictionary());
        var btn4 = ExtClass.get('btn4');
        btn4.on('click', Delegate.create(this, function() {
            SampleScripts.simple_widgets._runner.run(pbar4, btn4, 19, Delegate.create(this, function() {
                pbar4.updateText('All finished!');
            }));
        }));
    }
}


////////////////////////////////////////////////////////////////////////////////
// SampleScripts.simple_widgets._runner

SampleScripts.simple_widgets._runner = function SampleScripts_simple_widgets__runner() {
}
SampleScripts.simple_widgets._runner._f = function SampleScripts_simple_widgets__runner$_f(v, pbar, btn, count, onComplete) {
    return Delegate.create(null, function() {
        if (v > count) {
            btn.dom.disabled = false;
            onComplete.invoke();
        }
        else {
            var i = v / count;
            if (pbar.id === 'pbar4') {
                pbar.updateProgress(i, Math.round(100 * i) + '% completed...');
            }
            else {
                pbar.updateProgress(i, String.format('Loading item {0} of {1}...', v, count));
            }
        }
    });
}
SampleScripts.simple_widgets._runner.run = function SampleScripts_simple_widgets__runner$run(pbar, btn, count, onComplete) {
    btn.dom.disabled = true;
    var ms = 5000 / count;
    for (var i = 1; i < (count + 2); i++) {
        window.setTimeout(SampleScripts.simple_widgets._runner._f(i, pbar, btn, count, onComplete), i * ms);
    }
}


SampleScripts.core.TemplateScript.createClass('SampleScripts.core.TemplateScript');
SampleScripts.grid.ArrayGridScript.createClass('SampleScripts.grid.ArrayGridScript');
SampleScripts.grid.EditGridScript.createClass('SampleScripts.grid.EditGridScript');
SampleScripts.grid.CheckColumn.createClass('SampleScripts.grid.CheckColumn');
SampleScripts.grid.GroupingGridScript.createClass('SampleScripts.grid.GroupingGridScript');
SampleScripts.grid.PagingGridScript.createClass('SampleScripts.grid.PagingGridScript');
SampleScripts.grid.TotalsGridScript.createClass('SampleScripts.grid.TotalsGridScript');
SampleScripts.grid.XmlGridScript.createClass('SampleScripts.grid.XmlGridScript');
SampleScripts.IFrameComponent.createClass('SampleScripts.IFrameComponent', Ext.BoxComponent);
SampleScripts.SamplePanel.createClass('SampleScripts.SamplePanel', Ext.Panel);
SampleScripts.DefaultScript.createClass('SampleScripts.DefaultScript');
SampleScripts.panel.PanelScript.createClass('SampleScripts.panel.PanelScript');
SampleScripts.resizable.BasicScript.createClass('SampleScripts.resizable.BasicScript');
SampleScripts.simple_widgets.ProgressBarScript.createClass('SampleScripts.simple_widgets.ProgressBarScript');
SampleScripts.simple_widgets._runner.createClass('SampleScripts.simple_widgets._runner');
SampleScripts.SamplePanel.tpl = new Ext.XTemplate('<dl>' + '<tpl for=\"samples\">' + '<dt><a href=\"{url}\" target=\"_blank\"><img src=\"shared/screens/{icon}\"/></a><br/>' + '<span>{text}</span>' + '</dt>' + '</tpl>' + '</dl><div style=\"clear:both\"></div>');
SampleScripts.panel.PanelScript._html = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \r\n\t\t\tSed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. \r\n\t\t\tMaecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. \r\n\t\t\tVestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, \r\n\t\t\tsit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. \r\n\t\t\tSuspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.\r\n\t\t\t<br />\r\n\t\t\tAliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. \r\n\t\t\tAenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. \r\n\t\t\tMorbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. \r\n\t\t\tVivamus tincidunt diam nec urna. Curabitur velit.';

// ---- Do not remove this footer ----
// Generated using Script# v0.4.2.0 (http://projects.nikhilk.net)
// -----------------------------------
